package com.itheima.socket.tcp.demo14;

import java.io.*;
import java.net.Socket;

public class ClientDemo14 {

    public static void main(String[] args) throws IOException {

        Socket socket = new Socket("192.168.19.35", 8282);
        OutputStream outputStream = socket.getOutputStream();
        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("D:\\2019.7.30heima\\1.wmv"));
        byte[] bytes = new byte[1024];
        int length = -1;
        while ((length = bufferedInputStream.read(bytes)) != -1){
            outputStream.write(bytes, 0, length);
        }
        InputStream inputStream = socket.getInputStream();
        byte[] bytes1 = new byte[1024];
        int read = inputStream.read(bytes1);
        System.out.println(new String(bytes1, 0, read));
        bufferedInputStream.close();
        socket.close();
    }

}
